In this tutorial, we will list all of the file formats supported by the current version of the library. This tutorial assumes a basic understanding of JavaScript.
This page includes examples that you can try in the developer console. Open it now by pressing ctrl + shift + C (Apple + shift + C on Mac), and clicking Console.
Currently-supported formats
You shouldn't normally deal with file formats directly. The diary objects tutorial explains how to load diaries and automatically detect formats. But it can occasionally be useful to access the list of formats. For example, your app might want to display a list of supported formats:
- (Please enable JavaScript to see the list of formats)
This list was generated by examining the sleepdiary
variable. To see the variable itself, open the developer console by pressing ctrl + shift + C (Apple + shift + C on Mac), then type:
console.log(sleepdiary);
You can use this in your programs just like any other variable. For example, the list above was generated by this page's JavaScript.
Here are the meanings of each member in a format definition:
title
is the user-facing title for the formatname
is the name the code uses internally to refer to this formaturl
is a URL with more information about the formatlogo
is a URL containing an image associated with the file formaticon
is the name of an associated icon in a common icon list (at present, all icons begin withmdi-
, indicating Material Design Icons)extension
is the default file extension for files in this formatconstructor
is the constructor used to generate files of this format - you should not need to use this